/**
 * Created by wen.gao on 2017/5/7.
 */
// var seqelize = require("dao/mysql/npm_sequelize/sequelizeWrap");
// var userEntity = require("dao/mysql/npm_sequelize/entity/userEntity");

var userDao = {};

/**
 * insert function
 * */
userDao.insert = function (userEntity) {
    userEntity.sync({force: false}).then(function () {
        return userEntity.create({
            userName: userEntity.userName,
            userPassword: userEntity.userPassword,
            userGender: 0,
            userEmail : userEntity.userEmail,
            userPhone : userEntity.userPhone
        });
    }).catch(
        (err)=>console.log(err)
    );
};

/**
 * select a user by id
 * */
userDao.selectById = function (userEntity) {
    userEntity.findById(userEntity.userId).then(
        (data)=> {
            console.log(data)
            return data;
        }
    ).catch(
        (err)=> console.log(err)
    );
};

module.exports = userDao;

